// pages/volunteer/components/toast/index.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    visible: {
      type: Boolean,
      value: false
    },
    config:{
      type:Object,
      value:''
    }
  },
  observers: {
    "visible": function (val) {
      if (val) {
        this.hide()
      }
    }
  },
  /**
   * 组件的初始数据
   */
  data: {

  },

  /**
   * 组件的方法列表
   */
  methods: {
    hide() {
      const {config}=this.data
      var that = this
      setTimeout(() => {
        that.setData({
          visible: false
        })
      }, config.duration);
    }
  }
})